//
//  MyScoringViewController.m
//  Hxcsfw
//
//  Created by 企友软mac on 2018/1/9.
//  Copyright © 2018年 企友软mac. All rights reserved.
//

#import "MyScoringViewController.h"
#import "WWebViewController.h"

@interface MyScoringViewController ()<UIWebViewDelegate>

@property (nonatomic, strong)UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIButton *btnBack;
@property (weak, nonatomic) IBOutlet UIButton *btnRule;

@end

@implementation MyScoringViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.navigationController.navigationBarHidden = NO;
    [WShareUtil showWait:NO frame:CGRectMake(0, 64, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64)];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    _lbAcpoint.text = _strAcpoint;
    _lbCopoint.text = _strCopoint;
    _lbName.text = _strName;

    [_btnBack setImageEdgeInsets:UIEdgeInsetsMake(8, 12, 8, 12)];
    _btnRule.layer.borderColor = [UIColor whiteColor].CGColor;
    _btnRule.layer.borderWidth = 1;
    _btnRule.layer.cornerRadius = 6;

    NSDictionary *parametersDict = @{@"mode":@"web",@"service":@"wdjf",@"content":@{@"username":[WShareUtil sharedData].dicSession[@"nsrsbh"]}};
    NSString *strUrl = [NSString stringWithFormat:@"%@?params=",[WShareUtil getServerURL:nil]];
    strUrl = [WShareUtil webUrlAppendingString:strUrl dic:parametersDict];

    NSURLRequest * req = [NSURLRequest requestWithURL:[NSURL URLWithString:strUrl]];
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 220, WSCREENH_WIDTH, WSCREENH_HEIGHT - 220             )];
    _webView.delegate = self;
    [WShareUtil showWait:YES frame:CGRectMake(0, 64, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64)];

    [self.view addSubview:_webView];
    [_webView loadRequest:req];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [WShareUtil showWait:NO frame:CGRectMake(0, 64, WSCREENH_WIDTH, WSCREENH_HEIGHT - 64)];
}

- (IBAction)rightBtnClick:(UIButton *)sender {
    WWebViewController *webVc = [[WWebViewController alloc] init];
    webVc.strTitle = @"积分规则";
    webVc.strUrl = @"http://www.sx95113.com/zstapp?params=%2FO5VEuP53%2BWqeopc9K5F1VM9cHFSt7skYkaNuWT%2BEhO91t%2FtmPESFIOWIgmeUw55";
    [self.navigationController pushViewController:webVc animated:YES];
}

- (IBAction)leftBtnClick:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

@end
